import request from '@/utils/request'

// 查询培训列表
export function listTrain(query) {
  return request({
    url: '/work/train/list',
    method: 'get',
    params: query
  })
}

// 查询培训详细
export function getTrain(id) {
  return request({
    url: '/work/train/' + id,
    method: 'get'
  })
}

// 新增培训
export function addTrain(data) {
  return request({
    url: '/work/train/saveOrUpdate',
    method: 'post',
    data: data
  })
}

// 修改培训
export function updateTrain(data) {
  return request({
    url: '/work/train/saveOrUpdate',
    method: 'post',
    data: data
  })
}

// 删除培训
export function delTrain(id) {
  return request({
    url: '/work/train/delete-by-id',
    method: 'get',
    params: { "id": id }
  })
}

export function delTrains(ids) {
  return request({
    url: '/work/train/delete-by-ids',
    method: 'get',
    params: { "ids": ids }
  })
}




// 查询项目列表
export function listProject(id) {
  return request({
    url: '/work/train/getProjectsByTrainId',
    method: 'get',
    params: { "trainId": id }
  })
}

// 查询项目详细
export function getProject(id) {
  return request({
    url: '/work/train/project/' + id,
    method: 'get'
  })
}

// 新增项目
export function addProject(data) {
  return request({
    url: '/work/train/project/saveOrUpdate',
    method: 'post',
    data: data
  })
}

// 修改项目
export function updateProject(data) {
  return request({
    url: '/work/train/project/saveOrUpdate',
    method: 'post',
    data: data
  })
}

// 删除项目
export function delProject(id) {
  return request({
    url: '/work/train/project/delete-by-id',
    method: 'get',
    params: {
      "id": id
    }
  })
}

// export function delProjects(ids) {
//   return request({
//     url: '/work/competition/project/delete-by-ids',
//     method: 'get',
//     params: {
//       "ids": ids
//     }
//   })
// }



// 项目大类
export function getTypeDic() {
  return request({
    url: '/work/train/getTypeDic',
    method: 'get'
  })
}

// 项目小类
export function getProjectDic(type) {
  return request({
    url: '/work/train/getProjectDic',
    method: 'get',
    params: { "type": type }
  })
}

// 获取组别dic
export function getGroupsDic() {
  return request({
    url: '/work/train/getGroupDic',
    method: 'get',
  })
}